home *** CD-ROM | disk | FTP | other *** search
- Path: news.bridge.net!news
- From: David Byrden <100101.2547@compuserve.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Copy constructing an already default constructed object
- Date: 26 Jan 1996 14:36:00 GMT
- Organization: self-employed
- Message-ID: <4eaosg$ab7@news.bridge.net>
- References: <4e906b$stk@elaine32.Stanford.EDU>
- NNTP-Posting-Host: ppp-mia1-49.bridge.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
-
-
- >> I'd like to know what people think of the solution I've reached.
-
- No offence, but you genuinely do not know what you are doing. I recommend
- some serious study of worked examples of C++.
-
- For example, you should never use memcpy to copy C++ objects. There are
- many reasons.
-
- I simply can't understand why it is that you won't write an assignment
- operator like this;
-
- A& operator=( const A&* other )
- {
- return if assigning self to self
- do what the dtor does
- do what the copy ctor does
- return *this
- }
-
-
- This is the basic model for an assignment operator, although it usually
- can be internally optimised
-
-
- >> I figure that this type of shit is common enough
-
- C++ is not the only language where you need improvements.
-
-
- David
-
-
-